$(document).ready(function () {

    initTable();
})


function initTable() {
    $(`#list`).bootstrapTable({
       /* url: '../../mock/user.json',*/
     /*    url:'http://test.org/user/list',*/
        url:'http://localhost:8088/user/list',
        columns: columns,
        singleSelect: true,
        clickToSelect: true,
        pagination:true, // 是否开启分页
        pageSize:5,      // 页面大小
        sidePagination: "client" //客户端分页
    })

}


var columns = [

    {
        checkbox: true
    },
    {
        field: 'username',
        width:"400px",
        title: '用户名'
    },
    {

        field:'desc',
        title:'备注'
    },
    {
        field: 'userId',
        title: '操作',
        formatter: function (val, row, index) {
            // return val+row+index;
            var container = $('<div></div>');
            var btnGroup = $('<div class="btn-group"></div>').addClass('inner-group') ; // 按钮容器

            var btnEdit = $('<button></button>').text('修改')
                .addClass('btn').addClass('btn-warning');
            var btnRemove = $('<button></button>').text('删除')
                .addClass('btn').addClass('btn-danger');
            btnGroup.append(btnEdit);
            btnGroup.append(btnRemove);
            container.append(btnGroup)
            return container.html();

        }
    }

]
